package com.yododo.deploy;


import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;

public class PmsDeployWar {
    
    public static void main(String[] args) throws IOException {
        String projectDir = "D:/javaWork/projects/PMS/";
        String destPath = "E:/deploy/";

        copyFile(new File(projectDir + "pms-web/target/PMS-master.war"),new File(destPath + "PMS-master.war"));
        copyFile(new File(projectDir + "pms-web/target/PMS-slave.war"),new File(destPath + "PMS-slave.war"));
        copyFile(new File(projectDir + "pms-web/target/pms-test.war"),new File(destPath + "PMS-test.war"));
        
        copyFile(new File(projectDir + "pms-api-web/target/PMSAPI-master.war"), new File(destPath + "PMSAPI-master.war"));
        copyFile(new File(projectDir + "pms-api-web/target/PMSAPI-slave.war"),new File(destPath + "PMSAPI-slave.war"));
        copyFile(new File(projectDir + "pms-api-web/target/pmsapi-test.war"), new File(destPath + "PMSAPI-test.war"));
        
        copyFile(new File(projectDir + "pms-api/target/API-master.war"), new File(destPath + "API-master.war"));
        copyFile(new File(projectDir + "pms-api/target/API-slave.war"), new File(destPath + "API-slave.war"));
        copyFile(new File(projectDir + "pms-api/target/API-test.war"), new File(destPath + "API-test.war"));
        
        copyFile(new File(projectDir + "pms-finance/target/finance-master.war"), new File(destPath + "finance-master.war"));
        copyFile(new File(projectDir + "pms-finance/target/finance-slave.war"),new File(destPath + "finance-slave.war"));
        copyFile(new File(projectDir + "pms-finance/target/finance-test.war"), new File(destPath + "finance-test.war"));
        
        copyFile(new File(projectDir + "pms-ctrip/target/ctrip-master.war"), new File(destPath + "ctrip-master.war"));
        copyFile(new File(projectDir + "pms-ctrip/target/ctrip-slave.war"),new File(destPath + "ctrip-slave.war"));
        copyFile(new File(projectDir + "pms-ctrip/target/ctrip-test.war"), new File(destPath + "ctrip-test.war"));
        
        copyFile(new File(projectDir + "pms-quhuhu/target/quhuhu-master.war"), new File(destPath + "quhuhu-master.war"));
        copyFile(new File(projectDir + "pms-quhuhu/target/quhuhu-slave.war"), new File(destPath + "quhuhu-slave.war"));
        copyFile(new File(projectDir + "pms-quhuhu/target/quhuhu-test.war"), new File(destPath + "quhuhu-test.war"));
        
        copyFile(new File(projectDir + "pms-elong/target/Elong-production.war"), new File(destPath + "Elong-production.war"));
        
        System.out.println("finished");
    }
    
    private static void copyFile(File srcFile, File targetDict) throws IOException {
        if(!srcFile.exists()) {
            return;
        }
        FileUtils.copyFile(srcFile, targetDict);
        System.out.println("copy " + srcFile.getAbsolutePath() + " success.");
    }
    
}
